//
//  HExamPaperTableViewCell.m
//  NursingManages
//
//  Created by Zhen Huang on 17/9/26.
//  Copyright © 2017年 huangzhen. All rights reserved.
//

#import "HExamPaperTableViewCell.h"

@implementation HExamPaperTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self.contentView addSubview:self.examNameLabel];
        [self.contentView addSubview:self.startTimeLabel];
        [self.contentView addSubview:self.endTimeLabel];
        [self.contentView addSubview:self.examTimeLabel];
        [self.contentView addSubview:self.quesCountsLabel];
        
    }
    return self;
}

- (UILabel *)examNameLabel
{
    if (!_examNameLabel) {
        _examNameLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, ScreenWidth - 20, 30)];
        _examNameLabel.font = [UIFont systemFontOfSize:18];
    }
    return _examNameLabel;
}

- (UILabel *)startTimeLabel
{
    if (!_startTimeLabel) {
        _startTimeLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, self.examNameLabel.bottom + 10, ScreenWidth - 20, 30)];
        _startTimeLabel.font = [UIFont systemFontOfSize:15];
    }
    return _startTimeLabel;
}

- (UILabel *)endTimeLabel
{
    if (!_endTimeLabel) {
        _endTimeLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, self.startTimeLabel.bottom + 10, ScreenWidth - 20, 30)];
        _endTimeLabel.font = [UIFont systemFontOfSize:15];
    }
    return _endTimeLabel;
}

- (UILabel *)examTimeLabel {
    if (!_examTimeLabel) {
        _examTimeLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, self.endTimeLabel.bottom + 10, ScreenWidth * 0.4, 30)];
        _examTimeLabel.font = [UIFont systemFontOfSize:15];
    }
    return _examTimeLabel;
}

- (UILabel *)quesCountsLabel
{
    if (!_quesCountsLabel) {
        _quesCountsLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.examTimeLabel.right + 10, self.endTimeLabel.bottom + 10, ScreenWidth *0.5, 30)];
        _quesCountsLabel.textAlignment = NSTextAlignmentRight;
        _quesCountsLabel.font = [UIFont systemFontOfSize:15];
        _quesCountsLabel.textColor = RGB(69, 185, 124);
    }
    return _quesCountsLabel;
}

- (void)setTempModel:(Model_Hr_TestOnLine *)tempModel
{
    self.examNameLabel.text = tempModel.EXP_NAME;
    
    self.startTimeLabel.text = [NSString stringWithFormat:@"开始时间:%@",tempModel.START_TIME];
    
    self.endTimeLabel.text = [NSString stringWithFormat:@"截止时间:%@",tempModel.END_TIME];
    
    self.examTimeLabel.text = [NSString stringWithFormat:@"考试时长: %@ 分钟",tempModel.MINUTES];
    
    self.quesCountsLabel.text = [NSString stringWithFormat:@"总分%ld分",(long)tempModel.SCORE_COUNT];
    
    NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:self.examTimeLabel.text];

    [str addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(6,2)];

    self.examTimeLabel.attributedText = str;

}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
